mIRC Stats | Version 4.61 · mIRC 6.15 |
Right, so you're interested in making a mIRC Stats webpage for yourself. In this tutorial like documentation I'm going to explain the basics into doing this, I say basics because virtually anything can be done with it, within the limitations of mIRC and HTML ofcourse.. Basicly, a mIRC Stats webpage exists of two files (not counting files such as images). One file, which has the .msw extention, holds some information about the page; it's name, the author, etc.. The other file, which can have any extention you like with exeption of .msw, contains the actual webpage. The webpage is scripted, meaning it's contained in an alias (which you specify in the .msw file) and you can use all mIRC's commands and identifiers, but ofcourse it's best to stick to what you actually need. The alias is called everytime someone accesses or refreshes the page, so it's important you don't slow it down too much, this can be done by scripting multiple pages so not everything is loaded at once for example. All webpages are stored in the webpage folder inside mIRC Stats' own folder. In there, each webpage has it's own folder, to prevent filename collisions. Note that additional files, such as images, can only be viewed by yourself. This will change in future versions of mIRC Stats. |
This is the file which holds the information about your webpage. It's simply a text file, but with the .msw extention, so it can be listed by mIRC Stats. Each type of information is stored on a seperate line, you're allowed to leave lines blank if you want to, and lines starting with a semicolon (;) will be treated as a comment and thus ignored. The line starts with a keyword, which specifies what kind of info you're giving, after that comes the information. Note that the items are not case sensetive. Here are the items:
Name Example Author Voice of Power Email marckuiper@hotmail.com Website none Description This is an example description, blah blah blah. Version 1.0 MSVersion 4.6 Script example.mrc Alias statswebexample |
Ok, after creating the 'supportive file', it's time to build the actual webpage. Here's a few basic things you should know:
Since everything is basicly scripted in mIRC, you cannot just place all HTML in the file, and expect the data to be sent to the user connecting to the page. You will need to use a command for this: /sw. This command stands for mIRC's /sockwrite, and all you need to know about it really is that it sends the data to the user. Let us begin with a simple test, to see how everything works. If you don't know much about scripting, I'd advise you to follow every step I take closely. The following example would be your script file. As you can see everything's inclosed in the alias provided in the .msw file, and it's a combination of HTML and mIRC scripting. I've provided comments in green. ; the alias alias statswebexample { ; this data is sent to the user sw <html> sw Hello World! sw </html> } If you'd load this as a webpage, and then connect to your ip (ofcourse after using /statsweb), you'd see 'Hello World!'. You've just created the most basic type of webpage possible. Ofcourse we don't intend on keeping it this simple, we want to show statistics, and if possible in a nice looking interface too. So let us add some information using $sinfo: alias statswebexample { sw <html> sw <head> ; this is the title of the webpage. though you don't have to, you can see I've added the window title information ; which you can set in the config dialog, using $sinfo ; NOTE: as with all mIRC identifiers, you need to enclose it with spaces, otherwise everything after it will not be sent sw <title> Example webpage: $sinfo(p,wintitle) </title> sw </head> sw <body> ; just like the title, once again don't forget about the spaces, just try it to see what shows up now sw Nickname: $sinfo(p,nick) <br> sw Full name: $sinfo(p,fullname) <br> sw </body> sw </html> } That already looks a lot more interesting doesn't it? All you need to do now practicly is build some kind of table around it and use more of the features of $sinfo, voila! But again there's more we want, and more we CAN do. For instance you might want to add a box in which you show the time and such. But if you remember correctly, and you do, you can disable that in the config dialog. So you have to live up to that. I'll no longer include the entire alias, just the part which is significant for the example: ; this code has been directly extracted from the MetaX webpage ; as you can see, you can use if statements, this one checks wether to show the time or not ; as explained in the documentation for $sinfo, showtime returns $true or $false if ($sinfo(p,showtime)) { sw <table width="300" class="bar"> sw <tr><td colspan=2>Time:<hr class="hrblue"></td></tr> sw <tr><td width=100>Hour:</td><td> $sinfo(t,time) </td></tr> sw <tr><td>Date:</td><td> $sinfo(t,date) <br><br></td></tr> sw <tr><td>Total online:</td><td> $sinfo(t,totalonline) </td></tr> sw <tr><td>mIRC uptime:</td><td> $sinfo(t,mirc) </td></tr> sw <tr><td>System uptime:</td><td> $sinfo(t,system) </td></tr> sw </table> } This would look something like this:
|
Now that you understand the basics of how to make a webpage (I gave only few examples, but you know what you can do with $sinfo now), it is time to explain how to create multiple pages. Because I can understand you may not want everything gathered on a single page. This is where the $1 parameter comes in. When mIRC Stats calls for the alias, it will also send some extra data along with it. Which is, as with all mIRC scripting, stored in $1. Say, for example, someone connects to your page. This would mean the url would be something like: http://192.168.0.24:80/ (example ip). In this case, $1 would be '/'. And as you can see, a '/' is placed after the ip address. Now, you place a link on your page, and you call it something like "/info". In this case, if someone clicks on the link, the url would become http://192.168.0.24:80/info. And $1 will be '/info'. If you understand this, you know the rest is very simple, just make an if statement which checks what value $1 has. For example: if ($1 == /info) { sw This is where all kind of information goes. } elseif (/blah* iswm $1) { sw Different info is stored here. } else { sw This would be displayed when the user first connects to the page. } This way you can prevent from loading times being too long, or a page getting simply too big. Plus it adds more interactivity to it all. Ofcourse with this you can fake filenames, such as .php. And you can also make stuff like /file.php?id=172&view=1 for example, whatever you want.. |
This is the most difficult part of the webpage, and a higher knowledge of mIRC scripting is needed for this. The case is, it's not practical to let this data be returned by $sinfo, or any other home made alias. There's multiple ways for displaying all of the data for the server; all at once, a list of servers and when selected new lists of channels and query's (and their data) emerges, and probably more... Since it's would be a bit boring for me to cough up everything you'd need to do to script all of this, I will just keep it a bit more basic. To begin with, a way to list the servers (in a table for instance), which is easy enough: ; once again extracted from the MetaX webpage sw <table width="96%" class="bar"> ; the header of the table sw <tr><td>Server<hr></td><td>Network<hr></td><td>Nick<hr></td><td>Chans<hr></td><td>Query's<hr></td><td>More Info<hr></td></tr> ; this will check if you're connected at all, and if you're disconnected it will display that in the table if ($scon(1).status == disconnected) { sw <tr><td>Not connected</td><td>-</td><td>-</td><td>-</td><td>-</td><td>-</td></td> } ; a few local variables for the while loop var %s1 = $scon(0),%s2 = 1 ; while loop which will loop through all connections while (%s2 <= %s1) { ; checks if you're connected to the Nth server if ($scon(%s2).status == connected) { ; changes the active connection for the script (in other words identifiers and such will work for the Nth server) scon %s2 ; will add various informations about the server, such as it's url, the network, your nick.. sw <tr><td><a href="irc:// $+ $server $+ /"> $server </a></td><td> $iif($network,$ifmatch } inc %s2 1 } sw </table><hr> This might look very complicated, but just paste it into your webpage and you'll see it's just a very long line (because of all the table cells and all). As you can see I've used identifiers such as $scon, $chan and $query to retrieve some information about the servers. And /scon to switch through the servers. See mIRC's help file for a more detailed documentation for them. You've probably already seen how the webpages work. If so, you know you have to click the 'Click!' link to get more info about the selected server and a list of the open channels and query's. When clicking it you are linked to an url with the id of the server in it, so you can list various stuff for that connection, such as server information (but also anything you want..). I will not provide any extensive examples here, as you can see how everything works in one of the webpages. But I will give a list on what identifiers you can use in order to list the info:
For the channel information, you can use $chan(0) to loop them, and the $nick and $chan identifiers to retrieve information about them. See mIRC's help file or other webpages for more info. For the query information, you can use $query(0) to loop them, and the $query and $comchan identifiers to retrieve information about them. Again see mIRC's help file or the other webpages. Just fool around with it a bit, and use the $1 parameter wisely. You'll see it isn't that hard to figure out. |
Here are some things you should note when making a webpage, or just some handy tips:
|